class Solution(object):
    def removeDuplicates(self, nums):
        """
        :type nums: List[int]
        :rtype: int
        """
        if not nums:
            return 0
        slow=0
        for fast in range(1,len(nums)):
            if nums[fast]!=nums[slow]:
                slow+=1
                nums[slow]=nums[fast]
        return slow+1#返回不重复元素长度
solution =Solution()
nums=[1,2,3,3,4,4,5]
k=solution.removeDuplicates(nums)
print(k)
print(nums[:k])